package com.itheima.practice03;
//HashMap案例（存储学生+地址）
import java.util.HashMap;
public class HashMapTest {
    public static void main(String[] args) {
        //常见集合对象
        HashMap<Student,String> hashMap = new HashMap<>();
        Student student1 = new Student("三藏",31);
        Student student2 = new Student("三藏",31);
        Student student3 = new Student("悟空",5000);
        Student student4 = new Student("八戒",3200);
        //添加元素
        hashMap.put(student1,"东土大唐");
        hashMap.put(student2,"东土大唐");
        hashMap.put(student3,"石头");
        hashMap.put(student4,"高老庄");
        //遍历
        hashMap.forEach((student,adress)->{
            System.out.println(student+"="+adress);
        });
    }
}
